#pragma once
#include "xKernel/IxAttributeManager.h"

#include <hash_map>


class CxCallMethod;

typedef struct _AttributeData
{
    UUID                m_uuid;
    _AttributeData*     m_pNext;
    unsigned int        m_pMethod;
    CxCallMethod*       m_pCallMethod;

    _AttributeData()
        : m_uuid(GUID_NULL)
        , m_pNext(NULL)
        , m_pMethod(NULL)
        , m_pCallMethod(NULL)
    {}

}ATTRIBUTEDATA, *LPATTRIBUTEDATA;

[
    default(IxAttributeManager),
    threading(free),
    uuid("4C343BCC-7EF7-4247-9D2D-049A5078AEC6"),
    coclass
]
class CxAttributeManager : public IxAttributeManager
{
    typedef stdext::hash_map<INT, LPATTRIBUTEDATA>  ATTRIMAP;
    typedef ATTRIMAP::iterator                      ATTRIMAPIT;

public:
    CxAttributeManager();
    virtual ~CxAttributeManager();
    DECLARE_PROTECT_FINAL_CONSTRUCT()

public:
    // interface of IxAttributeManager
    HRESULT RegisterAttribute(BSTR bsName, INT nType, IID iid, UINT unMethod);
    HRESULT UnregisterAttribute(BSTR bsName, IID iid);
    HRESULT SetAttribute(IUnknown* pUnk, IxPairVec* pVec);

protected:
    ATTRIMAP m_mapAttribute;
};